Ubuntu 14.04
Sponsored Link

HAProxy : Refer to the Statistics#2
2016/01/07
 
Configure HAProxy to see HAProxy's Statistics with commands.
[1] Install some packages.
root@dlp:~#
apt-get -y install socat
[2] Configure HAProxy.
root@dlp:~#
vi /etc/haproxy/haproxy.cfg
# add follows in the "global" section

global
      # binds UNIX sockets

    stats socket /var/lib/haproxy/stats

root@dlp:~#
/etc/init.d/haproxy restart

[3] Refer to the Statistics like follows.
# display current stats

root@dlp:~#
echo "show info" | socat /var/lib/haproxy/stats stdio
Name: HAProxy
Version: 1.4.24
Release_date: 2013/06/17
Nbproc: 1
Process_num: 1
Pid: 1339
...
...
Run_queue: 1
node: dlp.srv.world
description:
# display stas with CSV

root@dlp:~#
echo "show stat" | socat /var/lib/haproxy/stats stdio
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,....
http-in,FRONTEND,,,0,1,2000,1,0,187,0,0,1,,,,,OPEN,,,,,,,,,1,1,0,,,,0,0,0,1,,,,0,0,0,1,0,0,,0,1,1,,,
backend_servers,www01,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,0,0,97,0,,1,2,1,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,0,,,,0,0,
backend_servers,www02,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,0,0,97,0,,1,2,2,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,0,,,,0,0,
backend_servers,BACKEND,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,UP,2,2,0,,0,97,0,,1,2,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,,0,0,
# display current session

root@dlp:~#
echo "show sess" | socat /var/lib/haproxy/stats stdio
0x251ffc0: proto=unix_stream ts=0b age=0s calls=1 rq[f=d09200h,l=0,an=00h,rx=10s,wx=,ax=] rp[f=009000h,
l=0,an=00h,rx=,wx=,ax=] s0=[7,8h,fd=1,ex=] s1=[7,8h,fd=-1,ex=] exp=
 
Tweet